<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/taglibs.jsp"%>
<script type="text/javascript">
$(function(){
	// 头像鼠标移上去显示菜单
	var timer;
	$(".header-user-info").hover(function() {
		var that = this;
		timer = setTimeout(function(){
			$(that).find(".option").slideDown(200);
		}, 300);
	}, function() {
		clearTimeout(timer);
		$(this).find(".option").slideUp(200);
	});
	// 美化select,并让验证插件支持select。select必须有id参数
	var prefix = 'selectBox_';
	$(".selecta,.selectb,.selectc,.selqu").each(function(){ 
		$(this).selectCss();
		$(this).parent(".select_box").attr("id", prefix + this.id);
		// 在select下添加一个隐藏域，name当前选中的option的name，value等于当前选中的option的code
		$(this).change(function(){
			var option = $(this).find("option:selected");
			var name = option.attr("name");
			if(!name) {
				option.val("");
				return;
			}
			var code = option.attr("code") || "";
			var hiddenInput = $("[type=hidden][name='"+ name +"']");
			if(hiddenInput.size() == 0) {
				$(this).append('<input type="hidden" name="'+ name +'" value="'+ code +'">');
			} else {
				hiddenInput.val(code);
			}
		});
		$(this).change(); // 这句代码是对有默认选项的select进行处理
	});
	// validationEngine自定义属性
	if($.validationEngine) {
		// 屏蔽处的用法配合validateCallback会使onSubmit提交2次
		/* $("form").validationEngine("attach", {
			promptPosition: 'centerRight',
			maxErrorsPerField: 1,
			prettySelect: true,
		    usePrefix: prefix
		}); */
		$.validationEngine.defaults.promptPosition = "centerRight";
		$.validationEngine.defaults.maxErrorsPerField = 1;
		$.validationEngine.defaults.prettySelect = true;
		$.validationEngine.defaults.usePrefix = prefix;
	}
});
</script>
<div class="m_top">
  <div class="t_wid">
    <div class="logo fl"><img src="${contextPath }/styles/public/images/logo.png" /></div>
    <ul id="menu">
	  <c:forEach var="level1" items="${menuModule.children }">
	    <c:if test="${level1.url == '#' }"><c:set var="goUrl" value="${level1.url }"/></c:if>
	    <c:if test="${level1.url != '#' }"><c:set var="goUrl" value="${contextPath }${level1.url }"/></c:if>
	    <a href='javascript:goToPage("${goUrl }")'>
	      <li name="${level1.sn }" <c:if test="${tag == level1.sn }">class="on"</c:if>>${level1.name }</li>
	    </a>											
	  </c:forEach>
    </ul>
    <div class="header-user-info">
      <img class="avatar" src="${contextPath }/styles/public/images/user.png" alt="" />
      <span class="name">${login_user.user.name }</span>
      <img class="upimg" src="${contextPath }/styles/public/images/up.png" />
      <ul class="option" style="z-index:9;">
        <a href="${contextPath }/manager/user/update"><li>个人资料</li></a>
        <a href="${contextPath }/logout"><li>退出</li></a>
      </ul>
    </div>
  </div>
</div>